<?php
class DBParam{
	protected $host, $user, $pass, $base, $type, $port;
	public $conn, $erro;
	
	function __construct($param){
		if(is_array($param)){
			if( $param['host'] ){ $this->host = $param['host']; } else { throw new Exception("Host inválido"); }
			if( $param['user'] ){ $this->user = $param['user']; } else { throw new Exception("Usuário invalido"); }
			if( $param['base'] ){ $this->base = $param['base']; } else { throw new Exception("Catálogo inválido"); }

			if( $param['pass'] ){ $this->pass = $param['pass']; } else { $this->pass = ''; }
			if( $param['type'] ){ $this->type = $param['type']; } else { $this->type = ''; }
			if(is_int($param['port'])){ $this->port = $param['port']; }else{ $this->port = ''; }
		}else{
			throw new Exception("Parâmetros inválidos");
		}
	}

	public function getHost(){ return $this->host; }
	public function getUser(){ return $this->user; }
	public function getPass(){ return $this->pass; }
	public function getBase(){ return $this->base; }
	public function getPort(){ return $this->port; }
	public function getType(){ return $this->type; }
}
?>
